package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Achievements_project;
import com.example.Laboratory.Mapper.Achievements_projectMapper;
import com.example.Laboratory.Service.Achievements_projectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Achievements_projectServiceImpl implements Achievements_projectService {

    @Autowired
    Achievements_projectMapper achievements_projectMapper;

    //增加科研成果-项目信息
    @Override
    public String addAchievements_project(Achievements_project p) {
        if (achievements_projectMapper.addAchievements_project(p) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }

    //根据id删除信息
    @Override
    public String deleteAchievements_project(int achievements_project_id) {
        if (achievements_projectMapper.deleteAchievements_project(achievements_project_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }

    //查找全表信息
    @Override
    public List<Achievements_project> researchAchievements_project() {
        return achievements_projectMapper.researchAchievements_project();
    }

    //修改信息
    @Override
    public String reviseAchievements_project(Achievements_project p) {
        if (achievements_projectMapper.reviseAchievements_project(p) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }
}
